﻿<html lang="zh-CN">
<!---------------------------------------------------------------------------
作者：邹辉《自动化平台测试开发》书；日期：2018年1月；版本：autotestplat V1.0
----------------------------------------------------------------------------->
<head>
{% load bootstrap4 %}
{% bootstrap_css %}
{% bootstrap_javascript %}
<title>产品自动化测试平台</title>
<link href="../static/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="/static/admin/css/forms.css" />



<script type="text/javascript" src="/admin/jsi18n/"></script>

<script type="text/javascript" src="/static/admin/js/vendor/jquery/jquery.js"></script>

<script type="text/javascript" src="/static/admin/js/jquery.init.js"></script>
<script type="text/javascript" src="/static/admin/js/core.js"></script>

<script type="text/javascript" src="/static/admin/js/admin/RelatedObjectLookups.js"></script>
<script type="text/javascript" src="/static/admin/js/actions.js"></script>

<script type="text/javascript" src="/static/admin/js/urlify.js"></script>

<script type="text/javascript" src="/static/admin/js/prepopulate.js"></script>

<script type="text/javascript" src="/static/admin/js/vendor/xregexp/xregexp.js"></script>


    
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0">
    
<link rel="stylesheet" type="text/css" href="/static/admin/css/responsive.css" />
    


<meta name="robots" content="NONE,NOARCHIVE" />


</head>
<body role="document">
<!-- 导航栏-->
<nav class="navbar navbar-expand-sm bg-dark navbar-dark fixed-top">
<div class="container">

<ul class="nav justify-content-center"> 
</ul>
<ul class="nav justify-content-end" style="position:absolute; right:10px; bottom:0px; ">
<li class="nav-link"><a style='color:white' href="#">{{user}}</a></li>
<li class="nav-link"><a style='color:white' href="/logout/">退出</a></li>
</ul>
</div>
</nav>
<!-- 搜索栏-->
<div class="page-header" style="padding-top: 0px;">
<form class="navbar-form" method="get" action="/tasksearch/"> 
{% csrf_token %}     
<input type="search" name="task" placeholder="名称" required>  
<button type="submit">搜索</button>   
<!-- 增加定时任务-->
<div style="float:right;width:65%">

<select name="PeriodicTask" id="PeriodicTask">
<option value="" selected>----定时任务----</option>
</select>
<a class="related-widget-wrapper-link change-related" id="change_id_PeriodicTask" data-href-template="/admin/djcelery/periodictask/__fk__/change/?_to_field=id&amp;_popup=1" title="更改选中的定时任务">
<img src="/static/admin/img/icon-changelink.svg" alt="修改"/>
</a>
<a  style='color:light blue' class="related-widget-wrapper-link add-related" id="add_id_PeriodicTask" href="/admin/djcelery/periodictask/add/?_to_field=id&amp;_popup=1" title="增加另一个 测试用例">
<img src="/static/admin/img/icon-addlink.svg" alt="增加"/>增加
</a>
</form>
</div>

<!-- 任务计划列表-->
<div class="row" style="padding-top: 0px;">
<div class="col-md-12">
<table class="table table-striped">
<thead>

<tr>
<th>ID</th><th>任务名称</th><th>任务模块</th><th>时间计划</th><th>修改时间</th><th>开启</th><th>立即</th><th>编辑</th><th>删除</th>
</tr>
</thead>
<tbody>
{% for task in tasks %}{% for periodic in periodics %}
<tr>

{% if task.interval_id != null and task.interval_id == periodic.id %}
<td>{{ task.id }}</td>
<td>{{ task.name }}</td>
<td>{{ task.task }}</td>
<td><a style='color:green'>每{{ periodic.period }} {{ periodic.every }}次</a> </td>
<td>{{ task.date_changed }}</td>
<td>{{ task.enabled }}</td>
<td>{% if task.id == 1 %}
<a href="../task_apis" target="mainFrame">运行</a>
{% elif task.id == 2 %}
<a href="../task_apitest" target="mainFrame">运行</a> 
{% elif task.id == 3 %}
<a href="../task_webtest" target="mainFrame">运行</a> 
{% elif task.id == 4 %}
<a href="../task_webtest2" target="mainFrame">运行</a> 
{% elif task.id == 5 %}
<a href="../task_apptest" target="mainFrame">运行</a> 
{% elif task.id == 6 %}
<a href="../task_apptest2" target="mainFrame">运行</a> 
{% elif task.id == 7 %}
<a href="../task_apptest2" target="mainFrame">运行</a>
{% else %}
{% endif %}
</td>
<td><a style='color:light blue' class="related-widget-wrapper-link add-related" id="add_id_Apitest" href="../admin/djcelery/periodictask/{{ task.id }}/change/?_to_field=id&_popup=1"><img src="/static/admin/img/icon-changelink.svg"/></a></td>
<td><a style='color:light blue' class="related-widget-wrapper-link add-related" id="add_id_Apitest" href="../admin/djcelery/periodictask/{{ task.id }}/delete/?_to_field=id&_popup=1"><img src="/static/admin/img/icon-deletelink.svg"/></a></td>

{% else %}

{% endif %}


{% for crontab in crontabs %}
{% if task.crontab_id != null and task.crontab_id == crontab.id %}
<td>{{ task.id }}</td>
<td>{{ task.name }}</td>
<td>{{ task.task }}</td>
<td><a style='color:green'>{{ crontab.month_of_year }}年{{ crontab.day_of_month }}月{{ crontab.day_of_week }}日{{ crontab.hour }}时{{ crontab.minute }}分</a> </td>
<td>{{ task.date_changed }}</td>
<td>{{ task.enabled }}</td>
<td>{% if task.id == 1 %}
<a href="../task_apis" target="mainFrame">运行</a>
{% elif task.id == 2 %}
<a href="../task_apitest" target="mainFrame">运行</a> 
{% elif task.id == 3 %}
<a href="../task_webtest" target="mainFrame">运行</a> 
{% elif task.id == 4 %}
<a href="../task_webtest2" target="mainFrame">运行</a> 
{% elif task.id == 5 %}
<a href="../task_apptest" target="mainFrame">运行</a> 
{% elif task.id == 6 %}
<a href="../task_apptest2" target="mainFrame">运行</a> 
{% elif task.id == 7 %}
<a href="../task_apptest2" target="mainFrame">运行</a>
{% else %}
{% endif %}
</td>
<td><a style='color:light blue' class="related-widget-wrapper-link add-related" id="add_id_Apitest" href="../admin/djcelery/periodictask/{{ task.id  }}/change/?_to_field=id&_popup=1"><img src="/static/admin/img/icon-changelink.svg"/></a></td>
<td><a style='color:light blue' class="related-widget-wrapper-link add-related" id="add_id_Apitest" href="../admin/djcelery/periodictask/{{ task.id  }}/delete/?_to_field=id&_popup=1"><img src="/static/admin/img/icon-deletelink.svg"/></a></td>
{% else %}
{% endif %}
{% endfor %}{% endfor %}{% endfor %}

</tbody>
</table>
</div>
</div>

<!--统计和翻页功能-->
<span style="position:absolute; left:600px; bottom:30px;">   {# 把翻页功能固定显示在右下角#}
<div style="position:absolute; right:950px; bottom:25px; width:100px;">
共:{{ taskcounts }}条记录 {# 前端读取定义的变量#}
</div>
<div class="container">
    <ul class="pagination" id="pager">
          {# 上一页链接开始#}
        {% if tasks.has_previous %}
            {#  如果有上一页则正常显示上一页链接#}
            <li class="previous"><a href="/periodic_task/?page={{ tasks.previous_page_number }}">上一页</a></li>    {#  上一页标签 #}
        {% else %}
            <li class="previous disabled"><a href="#">上一页</a></li> {# 如果当前不存在上一页则上一页的链接不可点击#}
        {% endif %}
        {# 上一页链接开始#}
        
        {% for num in tasks.paginator.page_range %}
         
            {% if num == currentPage %}
                <li class="item active"><a href="/periodic_task/?page={{ num }}">{{ num }}</a></li> {#显示当页数链接#} 
            {% else %}
                <li class="item"><a href="/periodic_task/?page={{ num }}">{{ num }}</a></li>
            {% endif %}
        {% endfor %}
        
        {# 下一页链接开始#}
        {% if tasks.has_next %} {#  如果有下一页则正常显示下一页链接#}
            <li class="next"><a href="/periodic_task/?page={{ tasks.next_page_number }}">下一页</a></li>
        {% else %}
            <li class="next disabled"><a href="#">下一页</a></li>
        {% endif %}
        {# 下一页链接结束#}
    </ul>
</div>

</body>
</html>
